public class Main {

    // preset
    static void humanPlayers() {
        Game game = new Game("dungeonF", 50);
        game.setPause(500);
        game.start();
    }

    // preset
    static void bestVSBest() {
        Game game = new Game("dungeonF", 200);
        game.setRogueAI("LoopElseFurthest");
        game.setMonsterAI("AStarManhattan");
        game.setPause(250);
        game.start();
    }

    static void comprehensiveTest() {
        String[] monsterStrategy = {"Random", "TowardChaste", "AStarChebyshev", "AStarManhattan"};
        String[] rogueStrategy = {"Random", "RunAway", "GoFurthest", "LoopElseFurthest"};
        char[] dungeons = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'Y', 'Z'};
        int[][][] scores = new int[20][4][4]; // dungeon, monsterAI, rogueAI
        StringBuilder sb = new StringBuilder();

        for (int dungeon = 0; dungeon < 20; dungeon++) {
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    Game game = new Game("dungeon" + dungeons[dungeon], 1000);
                    game.setMonsterAI(monsterStrategy[i]);
                    game.setRogueAI(rogueStrategy[j]);
                    scores[dungeon][i][j] = game.start();
                }
            }
        }

        for (int i = 0; i < 4; i++) {
            sb.append(String.format("\n\n\nMonster's steps to catch when Rogue uses the strategy: " + rogueStrategy[i] + "\n"));
            sb.append(String.format("%-15s%-15s%-15s%-15s%-15s", "dungeon", "Random", "TowardChaste", "AStarChebyshev", "AStarManhattan"));
            for (int dungeon = 0; dungeon < 20; dungeon++) {
                sb.append("\n");
                sb.append(String.format("%-15s%-15s%-15s%-15s%-15s", dungeons[dungeon],
                        scores[dungeon][0][i], scores[dungeon][1][i], scores[dungeon][2][i], scores[dungeon][3][i]));
            }
        }

        for (int i = 0; i < 4; i++) {
            sb.append(String.format("\n\n\nRogue's survival steps when Monster uses the strategy: " + monsterStrategy[i] + "\n"));
            sb.append(String.format("%-15s%-15s%-15s%-15s%-15s", "dungeon", "Random", "RunAway", "GoFurthest", "LoopElseFurthest"));
            for (int dungeon = 0; dungeon < 20; dungeon++) {
                sb.append("\n");
                sb.append(String.format("%-15s%-15s%-15s%-15s%-15s", dungeons[dungeon],
                        scores[dungeon][i][0], scores[dungeon][i][1], scores[dungeon][i][2], scores[dungeon][i][3]));
            }
        }
        System.out.println("\n" + sb);
    }


    // MonsterAI: Random, TowardChaste, AStarChebyshev, AStarManhattan (best)
    // RogueAI: Random, RunAway, GoFurthest, LoopElseFurthest (best)
    // map: dungeon + A B C D E F G H I J K L M N O P Q R Y Z

    public static void main(String[] args) {

//        humanPlayers();
//        bestVSBest();

//        comprehensiveTest();

        Game g = new Game("dungeonZ", 1000);
        g.setRogueAI("Random");
//        g.setRogueAI("LoopElseFurthest");
//        g.setMonsterAI("AStarManhattan");
        g.setPause(250);
        g.start();

    }
}